package com.bean;

/**
 * @Author xlkai
 * @Version 2016/10/30
 */
public class Page2 {

    private int pagestart; // start表示当前页开始的记录数,start=每页行数*(当前页数-1)
    private int totalCount; // 总行数
    private int rowsPerPage = 15; // 每页行数，默认15
    private int currentPage; // 当前页数

    private int pages;

    private Boolean pageIs = false; //是否分页

    public Page2() {
    }

    public int getPagestart() {
        pagestart = totalCount - rowsPerPage * currentPage;

        return (pagestart < 0 ? 0 : pagestart);
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
        if (this.totalCount % rowsPerPage == 0)
            pages = this.totalCount / rowsPerPage;
        else
            pages = this.totalCount / rowsPerPage + 1;
    }

    public int getRowsPerPage() {
        int start = totalCount - rowsPerPage * currentPage;
        if (start < 0) {
            return totalCount - rowsPerPage * (currentPage - 1);
        } else {
            return rowsPerPage;
        }
    }

    public void setRowsPerPage(int rowsPerPage) {
        this.rowsPerPage = rowsPerPage;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPages() {
        return pages;
    }

    public Boolean getPageIs() {
        return pageIs;
    }

    public void setPageIs(Boolean pageIs) {
        this.pageIs = pageIs;
    }
}
